import { createRouter, createWebHistory } from 'vue-router'

const routes = [
  {
    path: '/',
    name: 'main',
    component: () => import('../views/MainView.vue'),
    children:[
      {
        path: 'welcome',
        component: () => import('../views/main/WelcomeView.vue'),
      },
      {
        path: 'about',
        component: () => import('../views/main/AboutView.vue'),
      },
      {
        path: 'member/',
        children:[
          {
            path: 'ticket',
            component: () => import('../views/main/member/TicketView.vue'),
          },
        ]
      },
      {
        path: 'batch/',
        children:[
          {
            path: 'job',
            component: () => import('../views/main/batch/JobView.vue'),
          },
        ]
      },
      {
        path: 'base/',
        // 基础数据下的子路由
        children:[
          {
            path: 'station',
            component: () => import('../views/main/base/StationView.vue'),
          },
          {
            path: 'train',
            component: () => import('../views/main/base/TrainView.vue'),
          },
          {
            path: 'train-tation',
            component: () => import('../views/main/base/TrainStationView.vue'),
          },
          {
            path: 'train-carriage',
            component: () => import('../views/main/base/TrainCarriageView.vue'),
          },
          {
            path: 'train-seat',
            component: () => import('../views/main/base/TrainSeatView.vue'),
          },
        ]
      },
      {
        path: 'business/',
        // 业务管理下的子路由
        children:[
          {
            path: 'sk_token',
            component: () => import('../views/main/business/SKTokenView.vue'),
          },
          {
            path: 'confirm-order',
            component: () => import('../views/main/business/ConfirmOrderView.vue'),
          },
          {
            path: 'daily-train-ticket',
            component: () => import('../views/main/business/DailyTrainTicketView.vue'),
          },
          {
            path: 'daily-train',
            component: () => import('../views/main/business/DailyTrainView.vue'),
          },
          {
            path: 'daily-train-tation',
            component: () => import('../views/main/business/DailyTrainStationView.vue'),
          },
          {
            path: 'daily-train-carriage',
            component: () => import('../views/main/business/DailyTrainCarriageView.vue'),
          },
          {
            path: 'daily-train-seat',
            component: () => import('../views/main/business/DailyTrainSeatView.vue'),
          },
        ]
      },
    ]
  },
  {
    path: '',
    // 重定向到/welcome页面
    redirect: '/welcome'
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
